/*
 * distance.c
 *
 *  Created on: May 22, 2021
 *      Author: kirk_
 */

#include "distance.h"

void StartDistanceThread(void *argument)
{
	/* Init HC-SR04 */
	HCSR04_Init(&HCSR04, TRIG1_GPIO_Port, TRIG1_Pin, ECHO1_GPIO_Port, ECHO1_Pin);
	/* Infinite loop */
	for(;;)
	{
		osDelay(10);
		HCSR04_Measure(&HCSR04);
		PRINTF("Distance %u.\r\n", HCSR04_GetDistance(&HCSR04));
	}
}
